package com.daumcorp.searchdata.web;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.daumcorp.searchdata.service.BookService;

@Controller
@RequestMapping("/book")
public class BookController {
	@Autowired
	private BookService bookService;

	@RequestMapping(method = RequestMethod.GET)
	public String action(@RequestParam String isbn, ModelMap model) {
		List<String> list = new ArrayList<>();
		for (int i = 0; i < 10; i++) {
			list.add("avcd");
		}

		model.addAttribute("book", bookService.findBookByIsbn(isbn));
		model.addAttribute("test", list);
		return "book";
	}
}
